package com.treasure.mall.biz.service.core.integral.impl;

import com.treasure.mall.biz.entity.integral.UserIntegralLogPO;
import com.treasure.mall.biz.repository.integral.UserIntegralLogRepository;
import com.treasure.mall.biz.service.core.integral.IntegralService;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @author allan
 * @version 1.0.0
 * @date 2020/8/27
 */
@Service
public class IntegralServiceImpl implements IntegralService {
    @Resource
    private UserIntegralLogRepository logRepository;

    @Override
    public Page<UserIntegralLogPO> logsByUser(Long userId, int pageIndex, int pageSize) {

        return logRepository.findByUserId(userId, PageRequest.of(pageIndex - 1, pageSize));
    }
}
